package org.epidroid.epidroid.androsoul.widget;

import org.epidroid.epidroid.R;
import org.epidroid.epidroid.androsoul.engine.AndroSoul;

import android.app.Service;
import android.appwidget.AppWidgetManager;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;
import android.widget.RemoteViews;

public class AndroSoulWidgetService extends Service {

	public static final String UPDATE = "update";

	@Override
	public void onStart(Intent intent, int startId) {
		//String command = intent.getAction();
		int appWidgetId = intent.getExtras().getInt(
				AppWidgetManager.EXTRA_APPWIDGET_ID);
		RemoteViews remoteView = new RemoteViews(getApplicationContext()
				.getPackageName(), R.layout.androsoul_widget);
		AppWidgetManager appWidgetManager = AppWidgetManager
				.getInstance(getApplicationContext());

		remoteView.setTextViewText(R.id.androsoul_widget_login, "caca");

		// apply changes to widget
		appWidgetManager.updateAppWidget(appWidgetId, remoteView);
		super.onStart(intent, startId);
		Log.v(AndroSoul.LOGCAT, "widget service started");
	}

	@Override
	public IBinder onBind(Intent arg0) {
		return null;
	}

}
